package com.song.ResourceNode;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import com.song.ResourceNode.bean.ResourceConfig;

public class ResourceInit {
	
	
	
	public static void  init()
	{
		initConfig();
	}
	
	public static void initConfig()
	{
		
		Properties properties = new Properties();
		try {
			properties.load( new FileInputStream(new File("./config/NodeConfig.properties")));
			String isMaster = properties.getProperty("isMaster");
			String infoCenterAddr = properties.getProperty("infoCenterAddr");
			if(isMaster.equals("1"))
				ResourceConfig.isMaster =true;
			ResourceConfig.infoCenterAddr = infoCenterAddr;
			ResourceConfig.infoCenterPort = Integer.parseInt(properties.getProperty("infoCenterPort"));
			ResourceConfig.localAddr = properties.getProperty("localAddr");
			ResourceConfig.localPort = Integer.parseInt(properties.getProperty("localPort"));
			ResourceConfig.mapReduceClazz = properties.getProperty("mapreduce");
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
	}
	
	
}
